package com.ydzh.kfqgwvisitor.enums;

import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.extern.slf4j.Slf4j;

/**
 * @author zcj
 * @description
 * @date 2021/11/2021/11/19
 **/
@Getter
@AllArgsConstructor
@Slf4j
public enum PictureCheckEnum {
    /*
        0x1f902300-人脸检测错误（图片格式不符合要求、检测不到人脸等情况时）
        0x1f902301-人脸检测超时
        0x1f902303-图片两眼间距过小
        0x1f902304-图片彩色置信度过低
        0x1f902305-图片人脸角度过大
        0x1f902306-图片清晰度过低
        0x1f902307-图片过曝或过暗（灰阶值不符合要求）
        0x1f902308-图片遮挡严重
        0x1f902309-图片分数过低*/
    NOFACEDETECTED("0x1f902300", "检测不到人脸"),
    TIMEOUT("0x1f902301", "人脸检测超时"),
    THEDISTANCEBETWEENTHEEYESISTOOSMALL("0x1f902303", "图片两眼间距过小"),
    COLORCONFIDENCEISTOOLOW("0x1f902304", "图片彩色置信度过低"),
    FACEANGLEISTOOLARGE("0x1f902305", "图片人脸角度过大"),
    DEFINITIONISTOOLOW("0x1f902306", "图片清晰度过低"),
    OVEREXPOSEDOROVERDARK("0x1f902307", "图片过曝或过暗"),
    SEVEREOCCLUSION("0x1f902308", "图片遮挡严重"),
    SCOREISTOOLOW("0x1f902309", "图片分数过低");
    private String code;
    private String msg;

    public static String getMsg(String code) {
        PictureCheckEnum[] childLabelEnums = values();
        for (PictureCheckEnum childLabelEnum : childLabelEnums) {
            if (childLabelEnum.getCode().equals(code)) {
                return childLabelEnum.getMsg();
            }
        }
        log.error("未知海康的错误码：{}", code);
        return "照片评分过低，请尝试手机的远近距离。";
    }
}
